﻿using System;
using DevExpress.XtraBars;
using UniMana.Data;
using UniMana.Utils.Data;
using UniMana.Utils.Helper;
namespace UniMana.Win.Leadership
{
    public partial class FrmReport_SubStudent_Major : DevExpress.XtraEditors.XtraForm
    {
        /// <summary>
        /// 
        /// </summary>
        private DBMain m_ReportStudent_Major = new DBMain();
        public FrmReport_SubStudent_Major()
        {
            InitializeComponent();
            InitControlEvent();
        }
        public void InitControlEvent()
        {
            this.xucBar1.btnPrint_Click += 
                new UniMana.Utils.Controls.xucBar.ButtonClickHandler(
                    this.btnPrint_Click);
            ////this.xucBar1.btnExport_Click += 
            //new UniMana.Utils.Controls.xucBar.ButtonClickHandler(
            //    this.btnExportExcel_Click);
        }
        private void btnPrint_Click(object sender, ItemClickEventArgs e)
        {
            compositeLink_HienThi.ShowPreviewDialog();
        }
        
        private void ReportStudent_Major_Load(object sender, EventArgs e)
        {
            
            this.lueCatalogue_Major.GetData(
                m_ReportStudent_Major.m_DCReadOnly.Catalogue_Majors, 
                "Catalogue_MajorKey", 
                "Name");
        }

        private void btnView_Click(object sender, EventArgs e)
        {
            if (this.lueCatalogue_Major.EditValue != null)
            {
                grcStudent_Major.DataSource = 
                    m_ReportStudent_Major.m_DCReadOnly.Catalogue_Majors.Student_Major(
                    m_ReportStudent_Major.m_DCReadOnly.Training_Student_Classes,
                    m_ReportStudent_Major.m_DCReadOnly.Training_Students, 
                    m_ReportStudent_Major.m_DCReadOnly.Catalogue_Courses, 
                    this.lueCatalogue_Major.GetIntValue());
                grvStudent_Major.ExpandAllGroups();
                cacStudent_Major.DataSource = 
                    m_ReportStudent_Major.m_DCReadOnly.Catalogue_Majors.Student_Major(
                    m_ReportStudent_Major.m_DCReadOnly.Training_Student_Classes, 
                    m_ReportStudent_Major.m_DCReadOnly.Training_Students, 
                    m_ReportStudent_Major.m_DCReadOnly.Catalogue_Courses, 
                    this.lueCatalogue_Major.GetIntValue());

                 cacStudent_Major.Series[0].ArgumentDataMember = "TenKhoaHoc";
                cacStudent_Major.Series[0].TopNOptions.Enabled = true;
              cacStudent_Major.Series[0].Name = "Số sinh viên của ngành";
               cacStudent_Major.Series[0].TopNOptions.Enabled = true;
               cacStudent_Major.Series[0].ValueDataMembersSerializable = "TongSoSV";

            }
        }

        private void btnPrint_Click(object sender, EventArgs e)
        {

            compositeLink_HienThi.ShowPreview();
        }

    }
}